﻿Imports _1065144_1065164.DataProvider
Imports System.Data.SqlClient
Public Class LoaiTaiKhoanDAO
    Public Shared Function GetAll() As List(Of LoaiTaiKhoanDTO)
        Dim listLoaiTaiKhoan As New List(Of LoaiTaiKhoanDTO)
        Dim cn As SqlConnection = New SqlConnection(_strConnectionString)
        Dim cmd As New SqlCommand()
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "SelectLoaiTKALL"
        cmd.Connection = cn
        cn.Open()

        Dim rd As SqlDataReader = cmd.ExecuteReader()

        While rd.Read()
            Dim LoaiTaiKhoan As LoaiTaiKhoanDTO = New LoaiTaiKhoanDTO()
            'LoaiTaiKhoan.
            LoaiTaiKhoan.iMaLoaiTaiKhoan = rd.GetInt32(0)
            LoaiTaiKhoan.strTenLoaiTaiKhoan = rd.GetString(1)
            listLoaiTaiKhoan.Add(LoaiTaiKhoan)
        End While
        cn.Close()
        Return listLoaiTaiKhoan
    End Function
End Class
